<?php
require_once '..' . DS . '/DAO/Conexao.php';
require_once 'BeanVinculo.php';
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ModelVinculo
 *
 * @author David
 */
class ModelVinculo {

    public $p = null;

    public function ModelVinculo() {
        $this->p = Conexao::Intancia()->Db();
    }

    //GETS
    public function getTipoVinculo() {
        $sql = "SELECT *FROM vinculo ORDER BY vin_descricao;";
        $stmt = $this->p->prepare($sql);
        $res = $stmt->execute();

        $resultado = array();
        if ($res != 1) {
            $resultado = "erro";
        } else {
            while ($linha = $stmt->fetch()) {
                $beanVinculo = new BeanVinculo();
                $beanVinculo->codigo = $linha["vin_id"];
                $beanVinculo->vinculo = $linha["vin_descricao"];
                $resultado[] = $beanVinculo;
            }
        }
        return $resultado;
    }

}